<script>
import logo from '@/views/images/R-C.png'
export default {
  //调用方法获取userName
  created() {
    this.getuserName()
  },
  name: "People",
  data() {
    return {
      index1:true,
      index2:false,
      index3:true,
      index4:true,
      index5:false,
      logo: logo,
      //获取sessionStorage中的数组
      uid6:window.sessionStorage.getItem('userId1'),
      registerForm: {
        userName: '',
        phone: '',
        email: '',
        userAvatar: '',
        userSex: '',
        userNickname: '',
        isBusinesses: '',
        isVendor: ''
      },
      //
      uid:this.$root.uid,
    }
  },
  methods: {
    //调用方法获取userName
    getuserName() {
      this.uid6 = window.sessionStorage.getItem('userId1')
      if(this.uid6!=null){
        //调用方法获取registerForm
        this.$axios.post(`/zhuche/selectById1/${this.uid6}`).then(res => {
          console.log(999999,res.data)
          this.registerForm = res.data
          console.log(1,res.data.isVendor)
          console.log(2,res.data.isBusinesses)
          if (res.data.isVendor == 0){
            this.index2=true
            this.index3=false
          }
          if(res.data.isBusinesses==0){
             this.index4=false
            this.index5=true
          }
        })
        //查询用户下面的注册的身份(商户或供应商)
        this.$axios.post(`Businesses/${this.uid}`).then(r => {
          this.$root.businessesId=r.data.id;
          console.log("账号商户id",this.$root.businessesId)
        })
        this.$axios.post(`vendor/${this.uid}`).then(r => {
          this.$root.vendorId=r.data.id;
          console.log("账号供应商id",this.$root.vendorId)
        })
      }
    }
  }
}
</script>

<template>
  <el-container style="height: 750px; border: 1px solid #eee;">
    <el-aside v-show="index1" width="200px" style="background-color: rgb(238, 241, 246);margin-top: 40px">
      <el-menu
      :router="true"
               default-active="2"
               class="el-menu-vertical-demo"
               >
          <el-submenu index="1">
          <template slot="title">个人用户信息</template>
          <el-menu-item v-show="false" index="/Login"></el-menu-item>
          <el-menu-item class="el-icon-user" index="/User">用户中心</el-menu-item>
          <el-menu-item class="el-icon-edit-outline" index="/Pass">修改密码</el-menu-item>
          <el-menu-item class="el-icon-s-claim" index="/Suser">订单中心</el-menu-item>
          <el-menu-item class="el-icon-warning" index="/select3">注销</el-menu-item>
        </el-submenu>
        <el-submenu index="/Suser">
          <template slot="title">商户信息</template>
          <el-menu-item v-show="index4" index="/businesses1">商户中心</el-menu-item>
          <el-menu-item v-show="index4" index="/businesses2">订单中心</el-menu-item>
          <el-menu-item v-show="index5" index="/businesses">注册</el-menu-item>
        </el-submenu>
        <el-submenu  index="3">
          <template slot="title">供应商信息</template>
          <el-menu-item v-show="index3" index="/vendor1">供应商中心</el-menu-item>
          <el-menu-item v-show="index3" index="/vendor2">查看平台货品及报价</el-menu-item>
          <el-menu-item v-show="index3" index="/vendor3">订单中心</el-menu-item>
          <el-menu-item v-show="index2" index="/vendor">注册</el-menu-item>
        </el-submenu>
      </el-menu>
    </el-aside>
    <el-container>
      <el-header style="text-align: right; font-size: 12px">
      </el-header>
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<style>
.el-header {
  background-color: #B3C0D1;
  color: #333;
  line-height: 60px;
}

.el-aside {
  color: #333;
}
</style>